<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="douban.js"></script>
    <script>
        // console.log(movies);
        // 格式:  1. <<西红柿首府>>  导演: 徐峥/冯小刚/...  演员: 徐峥/刘德华/..  上映日期: 2018
        var subjects = movies.subjects;
        for (var i=0; i<subjects.length; i++) {
            var str = (i+1) + '. ';
            str += '《' + subjects[i].title + '》 导演:';

            // 拼接导演
            var directors = subjects[i].directors;
            for (var j=0; j<directors.length; j++) {
                str += directors[j].name;
                if (j!==directors.length-1) {
                    str += '/';
                }
            }
            str += '  演员:';

            // 拼接演员
            var casts = subjects[i].casts;
            for (var k=0; k<casts.length; k++) {
                str += casts[k].name;
                if (k!==casts.length-1) {
                    str += '/';
                }
            }

            // 拼接日期
            str += '  上映日期:' + subjects[i].year;
            console.log(str);
        }
    </script>
</body>
</html>